type AllCombinations<
  S extends string,
  U = StringToUnion<S>
> = S extends `${infer F}${infer R}` ? U : "";

type Result = AllCombinations<"AB">; // StringToUnion AllCombinations
